import request from '@/utils/request';

const roleApi = {};

roleApi.getResources = (id) => {
	return request({
		url: '/auth-api/role/resources/' + id,
		method: 'get',
	})
}
/* 为角色设置用户 */
roleApi.allocateUsers = (id, params) => {
	return request({
		url: '/auth-api/role/allocate-users/' + id,
		method: 'put',
		data: params
	})
}
/* 为角色设置资源 */
roleApi.allocateResources = (id, params) => {
	return request({
		url: '/auth-api/role/allocate-resources/' + id,
		method: 'put',
		data: params
	})
}
roleApi.list = () => {
	return request({
		url: '/auth-api/role/list',
		method: 'get',
	})
}
roleApi.page = (params) => {
	return request({
		url: '/auth-api/role/page',
		method: 'get',
		params: params,
	})
}
roleApi.get = (id) => {
	return request({
		url: '/auth-api/role/' + id,
		method: 'get',
	})
}
roleApi.delete = (id) => {
	return request({
		url: '/auth-api/role/' + id,
		method: 'delete',
	})
}
roleApi.add = (params) => {
	return request({
		url: '/auth-api/role',
		method: 'post',
		data: params
	})
}
roleApi.update = (params) => {
	return request({
		url: '/auth-api/role',
		method: 'put',
		data: params
	})
}
export default roleApi